#include <QtPlugin>

#include <QVBoxLayout>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QWidget>

#include <opencv/cv.h>
#include <opencv/highgui.h>

#include <iostream>

#include "QCVModuleInterface.h"
#include "QCVModuleHandlerInterface.h"

#ifndef MODULE_X
#define MODULE_X

class ModuleSBThreshold:public QObject,QCVModuleInterface
{
  Q_OBJECT
	Q_INTERFACES(QCVModuleInterface)
	
	public:
		void init(QCVModuleHandlerInterface * parent);
		void free();

		cv::Mat & process();
		void setInput(int n,const cv::Mat & m);

		QWidget* widget();
		QString getName();
		int nbInputs();
		QString help(int id);
		bool setParams(QString params);
		QString getParams();

		QCVModuleInterface * clone();

	private:  
	    void getBriSat(uchar r,uchar g,uchar b,uchar * L,uchar * S);
		
		QWidget * win;
	    QVBoxLayout * layout;
		
		QLabel * l_formula;
		QDoubleSpinBox * sb_A, *sb_B;
		
		cv::Mat image;

		QCVModuleHandlerInterface * parent;
};

#endif
